Set up a few directories we'll need

  $ . ./setup.sh
  $ mkdir -p node_modules
  $ mkdir -p app
  $ mkdir -p node_modules/.objs/melange
  $ mkdir -p app/.objs/melange
  $ mkdir -p output/node_modules
  $ mkdir -p output/app

  $ echo "let t = 1" > node_modules/a.ml
  $ cat > app/b.ml << EOF
  > let u = A.t
  > let t = ["Hello"] |> List.map(fun greeting -> greeting)
  > EOF

Generate the `.cmj` files

  $ melc -bs-package-output node_modules/ -bs-stop-after-cmj node_modules/a.ml -o node_modules/.objs/melange/a.cmj

  $ melc -ppx melppx -bs-package-output app/ -I node_modules/.objs/melange app/b.ml -bs-stop-after-cmj -o app/.objs/melange/b.cmj

Generate the JS files

  $ melc -bs-module-type commonjs node_modules/.objs/melange/a.cmj -o output/node_modules/a.js

  $ melc -bs-module-type commonjs -I node_modules/.objs/melange app/.objs/melange/b.cmj -o output/app/b.js

B depends on A, so it should import a.js in the right path

  $ cat output/app/b.js
  // Generated by Melange
  'use strict';
  
  const A = require("../node_modules/a.js");
  const Stdlib__List = require("melange/list.js");
  
  const t = Stdlib__List.map((function (greeting) {
    return greeting;
  }), {
    hd: "Hello",
    tl: /* [] */ 0
  });
  
  const u = A.t;
  
  module.exports = {
    u,
    t,
  }
  /* t Not a pure module */
